import thread.SocketRunable;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Serverentry {
    public static void main(String[] args) {
        //基于线程池设计,进行并发管理
        ExecutorService pool = Executors.newFixedThreadPool(20);
        //构建服务器端socket
        try {
            ServerSocket socket = new ServerSocket(10001);
            while (true) {
                //监听客户端连接
                Socket accept = socket.accept();
                //提交一个线程任务到线程池处理即可
                pool.submit(new SocketRunable(accept));
            }
        } catch (IOException e) {
        }
    }
}
